﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using EPiBoost.Core.Infrastructure.Interfaces.Model;

namespace EPiBoost.Core.Infrastructure.Model
{
	class LogItem : ILogItem
	{
		public DateTime LogDate { get; set; }
		public int Priority { get; set; }
		public string Category { get; set; }
		public string Message { get; set; }
		public string Exception { get; set; }
		public string Host { get; set; }
		public string Uri { get; set; }
		public string SourceMethod { get; set; }
		public int HttpStatusCode { get; set; }

		public LogItem()
		{
			LogDate = DateTime.Now;
		}

		public LogItem(HttpContext context)
		{
			if(context!=null)
			{
				HttpStatusCode = context.Response.StatusCode;
				Host = context.Request.Url.AbsoluteUri.Replace(context.Request.Url.AbsolutePath, "");
				Uri = context.Request.RawUrl;
			}
		}
	}
}
